/**
 * 
 */
package cvcg.util;

import org.apache.click.Context;
import org.apache.click.control.Decorator;

import cvcg.dto.Top5ResultDTO;

/**
 * @author jaracje
 *
 */
public class Top5ResultDecorator implements Decorator 
{
	private String columnName;
	/* (non-Javadoc)
	 * @see org.apache.click.control.Decorator#render(java.lang.Object, org.apache.click.Context)
	 */
	public Top5ResultDecorator(String columnName) 
	{
		this.columnName = columnName;
	}
	@Override
	public String render(Object object, Context context) {
		Top5ResultDTO dto = (Top5ResultDTO) object;
		Integer points = dto.getPointsByPlayer(columnName);
		if (points!=null) 
		{
			return points.toString();
		} 
		return null;
	}

}
